<!DOCTYPE html>
<html>

    
    <head>
        <?php
        include 'browser_detect.php';
         $q = $_GET["q"];
         //$terms = array("irs", "Samsung Tablet", "Amazon Stores", "Xbox", "Kindle", "Playstation", "iPhone", "iPad", "Wii", "iPad", "Nook", "Windows Phone", "Macbook Pro");
    
       /*1. Health: Weigh Loss & Fitness, Anti-aging, Cancer, Dentistry and Orthodontics
2. Insurance: Car and auto insurance, Health and Medical Insurance
3. Computers & Internet: Computer Hardware, Computer Repairs, PC and Internet Security, Dedicated Hosting, ISP and Networking, Online Degree, SEO software and tools, Web Development
4. Banking and Finance: Loans and Mortgage, Credit and Finance, Debt consolidation
5.Legal representation: Searches for attorney increased the bidding rate for this niche
6. Digital Photography: digital photography schools, certificate, digital photography education, Careers in photography
7. Psychotherapy: We can include this category in health, but i think it is best to treat this as a different niche as it gives more adsense revenue as a separate site.
8. Real Estate: A damn good niche for getting good adsense income. Google pays nice price for clicks on these Real Estate related ads.
9. Consumer Electronics: Gadgets, Mobiles and many other Electronic devices
10. Antiques and Collectibles: Another good niche to choose for getting high adsense income.*/
        $terms = array ("Weigh Loss fitness",
                        "Anti-aging",
                        "Cancer Treatment",
                        "Dentistry Orthodontics",
                        "Car auto Insurance",
                        "Health Medical Insurance",
                        "Comptuer Repairs",
                        "PC and Internet Security",
                        "Dedicated Hosting",
                        "ISP and Networking",
                        "Online Degree",
                        " SEO software and tools",
                        "Loans and Mortgage",
                        "Credit and Finance",
                        "Debt consolidation",
                        "irs",
"Samsung Tablet", "Amazon Stores", "Xbox", "Kindle", "Playstation", "iPhone", "iPad", "Wii", "iPad", "Nook", "Windows Phone", "Macbook Pro", "blackberry",
"attorney",
"digital photography schools", "certificate", "digital photography education", "Careers in photography",
"Psychotherapy", "Real Estate", "buy house", " Antiques and Collectibles"
);


        if ($q == null)
            $q = $terms[rand(0, count($terms) - 1)];


        if (isMobile()) {
            $leftURL = "/gsearch";
            $rightURL = "/bmsearch";
            ?>

            <meta name="HandheldFriendly" content="true" />
            <meta name="viewport" content="width=device-width, height=device-height, user-scalable=no" />
            <?php
        } else {
            $leftURL = "/gsearch";
            $rightURL = "/bsearch";
        }

        if ($_GET["left_choice"] != NULL) {
            $leftURL = $_GET["left_choice"];
        } else if ($_COOKIE['left_choice'] != NULL) {
            $leftURL = $_COOKIE['left_choice'];
        }

        if ($_GET["right_choice"] != NULL) {
            $rightURL = $_GET["right_choice"];
        } else if ($_COOKIE['right_choice'] != NULL) {
            $rightURL = $_COOKIE['right_choice'];
        }
        ?>

          <title> One Search: <?php echo $q ?> </title>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <META HTTP-EQUIV="CACHE-CONTROL" CONTENT="NO-CACHE">
        <meta name="title" content="One Search: <?php echo $q ?>" />
        <title> One Search: <?php echo $q ?> </title>
        <meta name="keywords" content='<?php echo $_GET["q"]; ?>' />
        <meta name="description" content=" The best search tool. Search Once, you can get results from both google and bing side by side with 
              the same item highlighted.Google vs Bing  <?php echo $_GET["q"]; ?>  " />

        <link rel="stylesheet" type="text/css" href="css/wordlist.css"/> 
        <link rel="stylesheet" type="text/css" href="css/button.css"/> 
        <script src="//www.google.com/jsapi" type="text/javascript"></script>
        <script type="text/javascript">
            google.load('search', '1');
            function inputFocus() {
                document.getElementById('searchText').style['background'] = '';
            }

            function inputBlur() {
                var queryInput = document.getElementById('searchText');
                if (!queryInput.value) {
                    queryInput.style['background'] =
                        'white url(http://www.google.com/coop/images/'
                        + 'google_custom_search_watermark.gif) no-repeat 0% 50%';
                }
            }

            function init() {
                //var cx = '011152833664020937705:ytiupixbdcs';
                google.search.CustomSearchControl.attachAutoCompletion(
                '006146382722072746140:rc7_dtmydr0',
                //'011152833664020937705:ytiupixbdcs',
                document.getElementById('searchText'),
                'searchForm');
                inputBlur();
            }

            function submitQuery() {
                window.location = '/html/two_page_search_results.html?q='
                    + encodeURIComponent(
                document.getElementById('searchText').value);
                return false;
            }
            google.setOnLoadCallback(init);

         frame = '<iframe src="http://rcm.amazon.com/e/cm?lt1=_blank&bc1=ffffff&IS2=1&bg1=FFFFFF&fc1=000000&lc1=0000FF&t=oneseagetbotr-20&o=1&p=8&l=as4&m=amazon&f=ifr&ref=ss_til&asins=B000VEN3RW" style="width:120px;height:240px;" scrolling="no" marginwidth="0" marginheight="0" frameborder="0"></iframe>';
         function showItems()
         {
                 a = (arguments[0]);
                 html = "<table style='width:100%;height:120px;margin:0;padding:0'  align='middle'><tr>";
                 for (i=0; i<3; i++) {
                 asin = a.Items.Item[i].ASIN;
                //title =  a[i].Items.Item.ItemAttributes.Title;
                //image =  a[i].Items.Item.MediumImage.URL;
                html += "<td style='text-align:center;width:250px;font-size:normal'>";
                 //html += "<a style='font-size:small;margin:0' href=''> "+title+" </a> <br/>";
                //html += "<a href='www.elookinto.com'> <img src='"+image+"'/> </a>";
                  html += frame.replace('B000VEN3RW', asin);
               html += "</td>";
               }
               html += "</tr></table>";
                $("#item").html(html);
                $("#field").css('display', 'block');
         }

        </script>

        <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script>

        <script type="text/javascript" src="js/jquery.cookie.js"></script>


        <script>
             
            $(document).ready(function() {
    
        myurl = "http://oneq.elookinto.com/search/amazon/lookup.php" ;
       
       $.ajax({
       type: 'GET',
       url: myurl,
       data: {num:5,q: '<?php echo $q ?>' },
       async: true,
       jsonp: "jsonp",
       jsonpCallback: 'showItems',
       contentType: "application/json",
       dataType: 'jsonp',
      success: function(json) {
       //alert(json[0].Item.ASIN);
       //alert(json);
       //console.dir(json.sites);
    },
    error: function(e) {
       alert(e.status);
       console.log(e.statusText);
    }
   });
                     
                //$("#item").html();
                $("#left_frame").width($(document).width()/2-40);
                $("#right_frame").width($(document).width()/2-40);
             
                $("#hide_left").attr("checked",  $.cookie("hideItem") == "left");
                $("#hide_right").attr("checked",  $.cookie("hideItem") == "right");

                $("#hide_left").bind("click", function() {
                   //alert(1);    
                    if ($(this).attr('checked')) {
                        $("#hide_right").attr('checked', false);
                        $.cookie("hideItem", "left", { expires:365});
                    } else {
                        $.cookie("hideItem", "");
                    }
                    itemManage();
                });
                $("#hide_right").bind("click", function() {
                    if ($(this).attr('checked')) {
                        $("#hide_right").attr('checked', false);
                        $.cookie("hideItem", "right", { expires:365});
                    }  else {
                        $.cookie("hideItem", "");
                    }
                    itemManage();
                });
        
                
                
                
                $("select").change(function(ev) {
                    var newVal = $(this).val();
                    if ($("#left_choice").val() == $("#right_choice").val())
                    {
                        $(this).val($.data(this, 'val'));
                        return ;
                       
                    }
                    $.data(this, 'val', newVal);
                    $.cookie("left_choice", $("#left_choice").val(),  { expires:365})
                    $.cookie("right_choice", $("#right_choice").val(),  { expires:365})
                });
                
                if ($.cookie("left_choice") != null && $.cookie("right_choice") !=null)
                {
                    $("#left_choice").val($.cookie("left_choice"));
                    $("#right_choice").val($.cookie("right_choice"));
                }

            });
    

            $(window).resize(function() {
                $("#left_frame").width($(document).width()/2-20);
                $("#right_frame").width($(document).width()/2-20);
            });
        </script>

    </head>

    <body>

        <div class="topmenu" style="background-color: black;margin:0;padding:0;margin-top:-10px;margin-left:-10px">
            <a title="One Query Gets both Results from Bing and Google!" style="color:orange" href="/onesearch"> OneSearch </a>
            <a href="http://elookinto.com/wordlist"> Wordlist </a> 
            <a title="A large collection of test papers of most states of U.S. "
               href="http://elookinto.com/wordlist/gdoc/list.jsp" target='googledoc'> StateTestCollection </a>                        

            <!-- <a href="/wordlist_chinese"> ChineseWordlist </a>    -->
            <a href="http://elookinto.com/youaudio"> YouAudio </a>  

        </div>   

        <?php if (!isMobile()) { ?>
            <h2 align="center"" > One Search Gets Both Results from <span style="color: brown" > Google </span> and <span style="color:green">  Bing </span> </h1>
        <?php } else { ?>

            <h3 align="center"> One Search </h3>

       <?php
        }
        ?>
        <h2 align="center">
            <?php if (isMobile()) { ?>
          <!-- Begin BidVertiser code -->
<SCRIPT LANGUAGE="JavaScript1.1" SRC="http://bdv.bidvertiser.com/BidVertiser.dbm?pid=493246&bid=1225884" type="text/javascript"></SCRIPT>
<noscript><a href="http://www.bidvertiser.com">online advertising</a></noscript>
<!-- End BidVertiser code -->

     
            <?php } else { ?>
                   <fieldset id="field" style="width:800px;margin:auto;display:none">
                      <legend style="text-align:center;color:blue;font-size:14pt">Most Popluar Products from Amazon</legend>
                   <div id="item" style="border:2px;width:100%;text-align:center;">
                   </div>
                  </fieldset>
            <?php } ?>
        </h2>
        <h3 align="center"> 
            <form id="searchForm" method="GET">

                <input autocomplete="off" id="searchText" name=q type="text" value='<?php echo $q; ?>'
                       size= '<?php echo isMobile() ? "20" : "60"; ?>' maxlength=250/>


                <input type="button" value="X" onclick="$('#searchText').val('') "  style="margin-left: -40px"/>
                <input type="submit" value="Search" /> 
                <?php if (!isMobile()) { ?>
                    <a class="sp" onclick="window.external.AddSearchProvider('http://www.elookinto.com/onesearch/search.xml');" 
                       href="#">Add to browser search</a> <?php } ?>
                <br/>
                <span style="margin-left: 50px;float: left">
                    <select id="left_choice" name="left_choice">
                        <option value='/gsearch'> Google</option>
                        <option value='/bsearch'> Bing</option>
                        <option value="/ysearch"> Yahoo</option>
                        <option value="/asearch"> Ask</option>
                    </select>
                    <select id="right_choice" name="right_choice">
                        <option value="/bsearch"> Bing</option>
                        <option value="/gsearch"> Google </option>
                        <option value="/ysearch"> Yahoo</option>
                        <option value="/asearch"> Ask</option>
                    </select>
                </span>
                <input id="prev" type="submit" style="display:none"  value="Prev"/>
                <input id="next" type="submit" style="display:none"  value="Next"/> 

                <span style="font-weight:normal;font-size:small; margin-left:40px"> Hide the same items in Left Panel:
                    <input type="checkbox" id="hide_left" /> &nbsp; &nbsp; &nbsp; 
                Right Panel: <input type="checkbox" id="hide_right" /> </span>
                <input id="leftq" name=leftq type="hidden"  value=""/>
                <input id="rightq" name=rightq type="hidden"  value=""/>
            </form> </h3>



        <?php
        $leftq = $_GET["leftq"];
        $rightq = $_GET["rightq"];
        if ($leftq == null || strlen($leftq) == 0)
            $leftq = "q=" . $q;
        else
            $leftq = substr($leftq, 8);
        if ($rightq == null || strlen($rightq) == 0)
            $rightq = "q=" . $q;
        else
            $rightq = substr($rightq, 8);
//echo $leftq."====".$rightq."<br/>";
        ?>  
        <iframe width=800 height=2000 src='<?php echo$leftURL . "?" . $leftq; ?>'  id='left_frame'> </iframe>
        <iframe width=800 height=2000 src='<?php echo$rightURL . "?" . $rightq; ?>'  id='right_frame'> </iframe>

        <script>

            
            function getDoc(aid)
            {
                var x=document.getElementById(aid);
                var y=(x.contentWindow || x.contentDocument);
                if (y.document)y=y.document;
                return y; 
            }
   
       

            var delay = 1000;
            var max = 0;
            var handleLeft, handleRight;
            function clearTimer(force)
            {
                //alert(max);
                if (max < 7 && !force) return;
                window.clearInterval(handleLeft);
                window.clearInterval(handleRight);
            }

            
            function itemManage() {

                var color = ["red", "orange","IndianRed", "brown", "Olive", "Magenta", "Maroon", "Coral", "DarkRed", "DarkSalmon"];
                a1 = $('#right_frame').contents().find('a').toArray();
                a2 = $('#left_frame').contents().find('a').toArray();
                for (i=0; i<a1.length; i++)  $(a1[i]).attr("target", "_blank");
                for (j=0; j<a2.length; j++)  $(a2[j]).attr("target", "_blank");
                t=0;
                for (i=0; i<a1.length; i++){
                    for (j=0; j<a2.length; j++)
                    {
                        if ( $(a1[i]).attr("href") == $(a2[j]).attr("href") ){
                                     
                            $(a1[i]).css("color", color[t%10]);
                            $(a2[j]).css("color", color[t%10]);
                            //$(a2[j]).css("display", "none");
                            if ($("#hide_left").is(":checked"))  {
                                $(a2[j]).closest("li").css("display", "none");
                                 $(a2[j]).closest("div[class=tsrc_tled]").css("display", "none");
                              }
                            else {
                                $(a2[j]).closest("li").css("display", "block");
                                $(a2[j]).closest("div[class=tsrc_tled]").css("display", "block");
                              }

                            if ($("#hide_right").is(":checked")) {
                                $(a1[i]).closest("li").css("display", "none");
                                $(a1[i]).closest("div[class=tsrc_tled]").css("display", "none");
                              }
                            else {
                                 $(a1[i]).closest("li").css("display", "block");
                                  $(a1[i]).closest("div[class=tsrc_tled]").css("display", "block");
                            }
             
                            t++;    
                        };
                    }
                }
            }

             function   fixLatencyLoading()
              {
                    max++;
                   clearTimer(false);
                   gsearch = $('#left_frame').contents().find('a:contains("Next")');
                   bsearch =  $('#right_frame').contents().find('a:contains("Next")');
                   if (gsearch.size()>0 || bsearch.size()>0)
                    { $("#next").show();
                        //window.clearInterval(handleLeft);
                        //alert("next");
                        //clearTimer(true);
                        itemManage();
                    }

                    ggsearch = $('#left_frame').contents().find('a:contains("Prev")');
                    bbsearch =  $('#right_frame').contents().find('a:contains("Prev")');
                    //alert(bbsearch.size());
                   // alert(ggsearch.size());
                    //if (bbsearch.size()>0) alert(bbsearch.attr('href'))
                    if (ggsearch.size()>0 || bbsearch.size()>0) {
                        $("#prev").show();
                        //clearTimer(true);
                        itemManage();
                    }
               }

            $('#right_frame').ready(function(){
                                       
                handleRight = window.setInterval(function() {
                   
                 fixLatencyLoading();
                         
                }, delay);
               
            });

             function fixNav(navButtonTxt, frameId)
              {
                   navLink = $(frameId).contents().find('a:contains("' + navButtonTxt +'")');
                   if (navLink.size()>0) {
                    var nextHref = navLink.attr("href");
                        nextHref =  nextHref.replace(/\/search;.*\?/, "/search?"); //yahoo
                        nextHref =  nextHref.replace(/http:\/\/www\.ask\.com\/web/, "/search"); //ask
                        //alert(nextHref);
                        if (frameId.indexOf("left")>=0)
                         $("#leftq").val(nextHref);
                        if (frameId.indexOf("right")>=0)
                         $("#rightq").val(nextHref);

                  }
              }

            $('#left_frame').ready(function(){
             
                 handleLeft = window.setInterval(function() {

                 fixLatencyLoading();

                }, delay);

                
                 
                $("#next").bind("click", function() {
                  //alert(1);
                  fixNav("Next", "#left_frame");
                  fixNav("Next", "#right_frame");                
                });
                      
                $("#prev").bind("click", function() {
                   fixNav("Prev", "#left_frame");
                   fixNav("Prev", "#right_frame");
                  
                });
                 itemManage();
            });

        </script>


        <div id=adrite style="display:none">


        </div>

        <div id=g>
        </div>


        <h3 align="center"> Copyright (c) 2012, ELOOKINTO. </h3>

</body>
</html>
